home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 API Bible / Windows 95 API Bible 3 Disc Set.iso / Win32 API Bible Book 1 of 3 / CHAPTE22 / EX2.C < prev    next >
C/C++ Source or Header  |  1995-05-27  |  2KB  |  47 lines

  1. #include <genstub.c>
  2.  
  3. LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  4. {
  5.    switch (uMsg)
  6.    {
  7.          case WM_COMMAND:
  8.                switch ( LOWORD( wParam )  )
  9.                {
  10.                      case IDM_TEST:
  11.                      {
  12.                            TCHAR szBuffer[64];
  13.                            TCHAR szTemp[64];
  14.                            HDC   hDC = GetDC( hWnd );
  15.                            static TCHAR szStart [25] = "Special characters here:";
  16.                            static TCHAR szFrench[] = { 0x41, 0xee, 0x6e, 0xe9, 0 };
  17.  
  18.                            lstrcpy( szTemp, szStart );
  19.                            lstrcat( szTemp, szFrench );   // concatenate special chars.
  20.                            TextOut( hDC, 0, 0, szBuffer, wsprintf( szBuffer,
  21.                                     "Original String: %s", szTemp ) );
  22.                            CharUpperBuff( szTemp, lstrlen( szTemp ) );
  23.                            TextOut( hDC, 0, 20, szBuffer, wsprintf( szBuffer,
  24.                                     "After CharUpper: %s", szTemp) );
  25.                            CharLowerBuff( szTemp + 5, 10 ); // lower chars 6-15
  26.                            TextOut( hDC, 0, 40, szBuffer, wsprintf( szBuffer,
  27.                                     "After CharLower: %s", szTemp ) );
  28.                            strlwr( szTemp );  // THIS IS AN ERROR!
  29.                            TextOut( hDC, 0, 60, szBuffer, wsprintf( szBuffer,
  30.                                     "After strlwr: %s", szTemp));
  31.  
  32.                            ReleaseDC( hWnd, hDC );
  33.                      }
  34.                      break;
  35.                      case IDM_EXIT:
  36.                            DestroyWindow( hWnd );
  37.                      break;
  38.                }
  39.                break;
  40.          case WM_DESTROY:
  41.                PostQuitMessage( 0 );
  42.                break;
  43.          default:
  44.                return (DefWindowProc(hWnd, uMsg, wParam, lParam));
  45.    }
  46.    return (NULL);
  47. }